﻿using System;
using Thuoc24h.Business;
using CSS.Common;
using Thuoc24h.Common;

namespace Thuoc24h.Home.Pages
{
    public partial class News : BasePage.BasePages
    {
        private int PageSize = AppSettings.GetInt32("PageSize");
        private int page = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            page = Request.QueryString["page"].ToInt32Return0();

            if (!Page.IsPostBack)
            {
                var listNews = ReviewRepository.GetAllNews(page,pagerNews.PageSize);
              
                lvNewsHome.DataSource = listNews;
                lvNewsHome.DataBind();
                var listviewPager = ReviewRepository.GetAllNews();
                listViewPager.DataSource = listviewPager;
                listViewPager.DataBind();
                if (listviewPager.Count <= PageSize)
                {
                    pagerNews.Visible = false;
                }
            }
        }
    }
}